package Commandes;

import java.awt.color.ColorSpace;
import java.awt.image.BufferedImage;
import java.awt.image.ColorConvertOp;
import java.awt.image.ConvolveOp;
import java.awt.image.Kernel;
import projetjava.ApercuPhotoGrand;


public class Commande_NandB implements Commande{
    
    
    private ApercuPhotoGrand apg;
    
    public Commande_NandB(ApercuPhotoGrand apg) {
        
        this.apg=apg;
        
    }
    
    public boolean executer() {
        
        this.nb();
        return false;
    }
    
    public boolean cancel() {
        
        return false;
    }
    
    
    public void nb(){
        BufferedImage image = this.apg.getApercu();
        ColorSpace gris = ColorSpace.getInstance(ColorSpace.CS_GRAY);
        ColorSpace couleur = ColorSpace.getInstance(ColorSpace.CS_sRGB);
        ColorConvertOp ccop = new ColorConvertOp(couleur,gris,null);
        ccop.filter(image,image);
        this.apg.setApercu(image);
        
    }
}
